import miniCreateStore from './miniRedux'
//reducer
function tool(state = 0, action){
    switch (action.type){
        case '+':
            return state + 1
        case '-':
            return state - 1
        default:
            return 0
    }
}
const toolStore = miniCreateStore(tool)
const { getState, dispatch, subscribe } = toolStore
function listener(){
    console.log(`现在武器${getState()}把`)
}
subscribe(listener)
dispatch({type: '+'})
dispatch({type: '+'})
dispatch({type: '-'})